<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
  <meta name="theme-color" content="#222">
  <meta name="generator" content="Hexo 5.4.0">


  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">

  <link rel="stylesheet" href="/css/main.css">



  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.15.2/css/all.min.css">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/animate.css@3.1.1/animate.min.css">

  <script class="hexo-configurations">
    var NexT = window.NexT || {};
    var CONFIG = {
      "hostname": "holidaypenguin.gitee.io",
      "root": "/",
      "images": "/images",
      "scheme": "Mist",
      "version": "8.2.2",
      "exturl": false,
      "sidebar": {
        "position": "right",
        "display": "always",
        "padding": 18,
        "offset": 12
      },
      "copycode": true,
      "bookmark": {
        "enable": false,
        "color": "#222",
        "save": "auto"
      },
      "fancybox": false,
      "mediumzoom": false,
      "lazyload": false,
      "pangu": false,
      "comments": {
        "style": "tabs",
        "active": null,
        "storage": true,
        "lazyload": false,
        "nav": null
      },
      "motion": {
        "enable": true,
        "async": true,
        "transition": {
          "post_block": "fadeIn",
          "post_header": "fadeInDown",
          "post_body": "fadeInDown",
          "coll_header": "fadeInLeft",
          "sidebar": "slideUpIn"
        }
      },
      "prism": false,
      "i18n": {
        "placeholder": "搜索...",
        "empty": "没有找到任何搜索结果：${query}",
        "hits_time": "找到 ${hits} 个搜索结果（用时 ${time} 毫秒）",
        "hits": "找到 ${hits} 个搜索结果"
      },
      "path": "/search.xml",
      "localsearch": {
        "enable": true,
        "trigger": "auto",
        "top_n_per_article": 1,
        "unescape": false,
        "preload": false
      }
    };
  </script>
  <meta property="og:type" content="article">
  <meta property="og:title" content="2018年，JavaScript都经历了什么">
  <meta property="og:url" content="https://holidaypenguin.gitee.io/blob/2019-04-11-what-did-javascript-experience-in-2018/index.html">
  <meta property="og:site_name" content="HolidayPenguin">
  <meta property="og:locale" content="zh_CN">
  <meta property="og:image" content="https://holidaypenguin.gitee.io/images/FrontEnd/0002.png">
  <meta property="og:image" content="https://holidaypenguin.gitee.io/images/FrontEnd/0003.png">
  <meta property="og:image" content="https://holidaypenguin.gitee.io/images/FrontEnd/0004.png">
  <meta property="og:image" content="https://holidaypenguin.gitee.io/images/FrontEnd/0005.jpg">
  <meta property="og:image" content="https://holidaypenguin.gitee.io/images/FrontEnd/0006.png">
  <meta property="article:published_time" content="2019-04-11T07:24:36.000Z">
  <meta property="article:modified_time" content="2019-04-11T07:24:36.000Z">
  <meta property="article:author" content="holidaypenguin">
  <meta property="article:tag" content="2018">
  <meta name="twitter:card" content="summary">
  <meta name="twitter:image" content="https://holidaypenguin.gitee.io/images/FrontEnd/0002.png">


  <link rel="canonical" href="https://holidaypenguin.gitee.io/blob/2019-04-11-what-did-javascript-experience-in-2018/">


  <script class="page-configurations">
    // https://hexo.io/docs/variables.html
    CONFIG.page = {
      sidebar: "",
      isHome: false,
      isPost: true,
      lang: 'zh-CN'
    };
  </script>
  <title>2018年，JavaScript都经历了什么 | HolidayPenguin</title>





  <noscript>
    <style>
      body {
        margin-top: 2rem;
      }

      .use-motion .menu-item,
      .use-motion .sidebar,
      .use-motion .post-block,
      .use-motion .pagination,
      .use-motion .comments,
      .use-motion .post-header,
      .use-motion .post-body,
      .use-motion .collection-header {
        visibility: visible;
      }

      .use-motion .header,
      .use-motion .site-brand-container .toggle,
      .use-motion .footer {
        opacity: initial;
      }

      .use-motion .site-title,
      .use-motion .site-subtitle,
      .use-motion .custom-logo-image {
        opacity: initial;
        top: initial;
      }

      .use-motion .logo-line {
        transform: scaleX(1);
      }

      .search-pop-overlay,
      .sidebar-nav {
        display: none;
      }

      .sidebar-panel {
        display: block;
      }
    </style>
  </noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage" class="use-motion">
  <div class="headband"></div>

  <main class="main">
    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner">
        <div class="site-brand-container">
          <div class="site-nav-toggle">
            <div class="toggle" aria-label="切换导航栏" role="button">
              <span class="toggle-line"></span>
              <span class="toggle-line"></span>
              <span class="toggle-line"></span>
            </div>
          </div>

          <div class="site-meta">

            <a href="/" class="brand" rel="start">
              <i class="logo-line"></i>
              <h1 class="site-title">HolidayPenguin</h1>
              <i class="logo-line"></i>
            </a>
          </div>

          <div class="site-nav-right">
            <div class="toggle popup-trigger">
              <i class="fa fa-search fa-fw fa-lg"></i>
            </div>
          </div>
        </div>



        <nav class="site-nav">
          <ul class="main-menu menu">
            <li class="menu-item menu-item-home"><a href="/" rel="section"><i class="fa fa-home fa-fw"></i>首页</a></li>
            <li class="menu-item menu-item-tags"><a href="/tags/" rel="section"><i class="fa fa-tags fa-fw"></i>标签</a></li>
            <li class="menu-item menu-item-categories"><a href="/categories/" rel="section"><i class="fa fa-th fa-fw"></i>分类</a></li>
            <li class="menu-item menu-item-archives"><a href="/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档</a></li>
            <li class="menu-item menu-item-search">
              <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索
              </a>
            </li>
          </ul>
        </nav>



        <div class="search-pop-overlay">
          <div class="popup search-popup">
            <div class="search-header">
              <span class="search-icon">
                <i class="fa fa-search"></i>
              </span>
              <div class="search-input-container">
                <input autocomplete="off" autocapitalize="off" maxlength="80" placeholder="搜索..." spellcheck="false" type="search" class="search-input">
              </div>
              <span class="popup-btn-close" role="button">
                <i class="fa fa-times-circle"></i>
              </span>
            </div>
            <div class="search-result-container no-result">
              <div class="search-result-icon">
                <i class="fa fa-spinner fa-pulse fa-5x"></i>
              </div>
            </div>

          </div>
        </div>

      </div>


      <div class="toggle sidebar-toggle" role="button">
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
      </div>

      <aside class="sidebar">

        <div class="sidebar-inner sidebar-nav-active sidebar-toc-active">
          <ul class="sidebar-nav">
            <li class="sidebar-nav-toc">
              文章目录
            </li>
            <li class="sidebar-nav-overview">
              站点概览
            </li>
          </ul>

          <div class="sidebar-panel-container">
            <!--noindex-->
            <div class="post-toc-wrap sidebar-panel">
              <div class="post-toc animated">
                <ol class="nav">
                  <li class="nav-item nav-level-2"><a class="nav-link" href="#The-State-of-JavaScript-2018"><span class="nav-number">1.</span> <span class="nav-text">The State of JavaScript 2018</span></a></li>
                  <li class="nav-item nav-level-2"><a class="nav-link" href="#ECMAScript-2018"><span class="nav-number">2.</span> <span class="nav-text">ECMAScript 2018</span></a></li>
                  <li class="nav-item nav-level-2"><a class="nav-link" href="#Node-10"><span class="nav-number">3.</span> <span class="nav-text">Node 10</span></a></li>
                  <li class="nav-item nav-level-2"><a class="nav-link" href="#Vue-3-0"><span class="nav-number">4.</span> <span class="nav-text">Vue 3.0</span></a></li>
                  <li class="nav-item nav-level-2"><a class="nav-link" href="#Babel-7"><span class="nav-number">5.</span> <span class="nav-text">Babel 7</span></a></li>
                  <li class="nav-item nav-level-2"><a class="nav-link" href="#jQuery-3-3-0"><span class="nav-number">6.</span> <span class="nav-text">jQuery 3.3.0</span></a></li>
                  <li class="nav-item nav-level-2"><a class="nav-link" href="#V8%E5%BC%95%E6%93%8E10%E5%91%A8%E5%B9%B4"><span class="nav-number">7.</span> <span class="nav-text">V8引擎10周年</span></a></li>
                  <li class="nav-item nav-level-2"><a class="nav-link" href="#NPM%E6%A8%A1%E5%9D%97event-stream%E8%A2%AB%E9%BB%91%E5%AE%A2%E6%94%BB%E5%87%BB"><span class="nav-number">8.</span> <span class="nav-text">NPM模块event-stream被黑客攻击</span></a></li>
                  <li class="nav-item nav-level-2"><a class="nav-link" href="#%E3%80%8ARefactoring%E3%80%8B%E7%AC%AC2%E7%89%88%E6%94%B9%E7%94%A8JavaScript"><span class="nav-number">9.</span> <span class="nav-text">《Refactoring》第2版改用JavaScript</span></a></li>
                  <li class="nav-item nav-level-2"><a class="nav-link" href="#GitHub%E6%8A%9B%E5%BC%83jQuery"><span class="nav-number">10.</span> <span class="nav-text">GitHub抛弃jQuery</span></a></li>
                  <li class="nav-item nav-level-2"><a class="nav-link" href="#Microsoft%E7%88%B1%E4%B8%8AJavaScript"><span class="nav-number">11.</span> <span class="nav-text">Microsoft爱上JavaScript</span></a></li>
                  <li class="nav-item nav-level-2"><a class="nav-link" href="#Oracle%E5%AE%A3%E7%A4%BAJavaScript%E4%B8%BB%E6%9D%83"><span class="nav-number">12.</span> <span class="nav-text">Oracle宣示JavaScript主权</span></a></li>
                </ol>
                </li>
                <li class="nav-item nav-level-1"><a class="nav-link" href="#%E5%8F%82%E8%80%83"><span class="nav-number"></span> <span class="nav-text">参考</span></a>
              </div>
            </div>
            <!--/noindex-->

            <div class="site-overview-wrap sidebar-panel">
              <div class="site-author site-overview-item animated" itemprop="author" itemscope itemtype="http://schema.org/Person">
                <p class="site-author-name" itemprop="name">holidaypenguin</p>
                <div class="site-description" itemprop="description"></div>
              </div>
              <div class="site-state-wrap site-overview-item animated">
                <nav class="site-state">
                  <div class="site-state-item site-state-posts">
                    <a href="/archives/">

                      <span class="site-state-item-count">138</span>
                      <span class="site-state-item-name">日志</span>
                    </a>
                  </div>
                  <div class="site-state-item site-state-categories">
                    <a href="/categories/">

                      <span class="site-state-item-count">26</span>
                      <span class="site-state-item-name">分类</span></a>
                  </div>
                  <div class="site-state-item site-state-tags">
                    <a href="/tags/">

                      <span class="site-state-item-count">234</span>
                      <span class="site-state-item-name">标签</span></a>
                  </div>
                </nav>
              </div>
              <div class="links-of-author site-overview-item animated">
                <span class="links-of-author-item">
                  <a href="https://github.com/holidaypenguin" title="GitHub → https:&#x2F;&#x2F;github.com&#x2F;holidaypenguin" rel="noopener" target="_blank"><i class="github fa-fw"></i>GitHub</a>
                </span>
                <span class="links-of-author-item">
                  <a href="mailto:songshipeng2016@gmail.com" title="E-Mail → mailto:songshipeng2016@gmail.com" rel="noopener" target="_blank"><i class="envelope fa-fw"></i>E-Mail</a>
                </span>
              </div>



            </div>
          </div>
        </div>
      </aside>
      <div class="sidebar-dimmer"></div>


    </header>


    <div class="back-to-top" role="button">
      <i class="fa fa-arrow-up"></i>
      <span>0%</span>
    </div>

    <noscript>
      <div class="noscript-warning">Theme NexT works best with JavaScript enabled</div>
    </noscript>


    <div class="main-inner post posts-expand">





      <div class="post-block">



        <article itemscope itemtype="http://schema.org/Article" class="post-content" lang="zh-CN">
          <link itemprop="mainEntityOfPage" href="https://holidaypenguin.gitee.io/blob/2019-04-11-what-did-javascript-experience-in-2018/">

          <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
            <meta itemprop="image" content="/images/avatar.gif">
            <meta itemprop="name" content="holidaypenguin">
            <meta itemprop="description" content="">
          </span>

          <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
            <meta itemprop="name" content="HolidayPenguin">
          </span>
          <header class="post-header">
            <h1 class="post-title" itemprop="name headline">
              2018年，JavaScript都经历了什么
            </h1>

            <div class="post-meta-container">
              <div class="post-meta">
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-calendar"></i>
                  </span>
                  <span class="post-meta-item-text">发表于</span>

                  <time title="创建时间：2019-04-11 15:24:36" itemprop="dateCreated datePublished" datetime="2019-04-11T15:24:36+08:00">2019-04-11</time>
                </span>
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-folder"></i>
                  </span>
                  <span class="post-meta-item-text">分类于</span>
                  <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                    <a href="/categories/FrontEnd/" itemprop="url" rel="index"><span itemprop="name">FrontEnd</span></a>
                  </span>
                </span>


                <span id="/blob/2019-04-11-what-did-javascript-experience-in-2018/" class="post-meta-item leancloud_visitors" data-flag-title="2018年，JavaScript都经历了什么" title="阅读次数">
                  <span class="post-meta-item-icon">
                    <i class="far fa-eye"></i>
                  </span>
                  <span class="post-meta-item-text">阅读次数：</span>
                  <span class="leancloud-visitors-count"></span>
                </span>
              </div>

              <div class="post-description">
                <!-- more -->
              </div>
            </div>
          </header>




          <div class="post-body" itemprop="articleBody">
            <blockquote>
              <p>本文转载自：<a target="_blank" rel="noopener" href="https://blog.fundebug.com/2018/12/25/what-happens-in-2018-for-javascript/">2018年，JavaScript都经历了什么？</a></p>
            </blockquote>
            <p>本文灵感来自<a target="_blank" rel="noopener" href="https://javascriptweekly.com/">JavaScript Weekly</a>周报，欢迎大家订阅。</p>
            <h2 id="The-State-of-JavaScript-2018"><a href="#The-State-of-JavaScript-2018" class="headerlink" title="The State of JavaScript 2018"></a>The State of JavaScript 2018</h2>
            <p><a target="_blank" rel="noopener" href="https://2018.stateofjs.com/">The State of JavaScript</a>调研已经连续做了3年(<a target="_blank" rel="noopener" href="http://2016.stateofjs.com/">2016</a>, <a target="_blank" rel="noopener" href="https://2017.stateofjs.com/">2017</a>, <a target="_blank" rel="noopener" href="https://2018.stateofjs.com/">2018</a>)，<a target="_blank" rel="noopener" href="https://2018.stateofjs.com/">2018</a>一共调研了2万多个JS开发者。有这样一些有意思的发现：</p>
            <ul>
              <li>绝大多数开发者都用过ES6，同时TypeScript也越来越流行了；</li>
              <li>React依然最流行的前端框架，同时Vue也越来越受欢迎了；</li>
              <li>Express依然是最流行的Node.js框架(Node 8已经支持async函数了，Koa的价值应该少了很多)；</li>
              <li>Visual Studio code远远超越Sublime，成为最流行的JS编辑器；</li>
            </ul>
            <p>作为一个后端用Express框架，尽量使用最新的ECMAScript语法，而前端用着TypeScript，不过框架还是AngularJS 1(这事要怪版本帝Angular不向后兼容)，抛弃价值70刀的Sublime，今年加入VS code阵营的JSer，我也是算是够主流了吧！那你呢？</p>
            <h2 id="ECMAScript-2018"><a href="#ECMAScript-2018" class="headerlink" title="ECMAScript 2018"></a>ECMAScript 2018</h2>
            <p>TC39(ECMAScript标准委员会)这些年越来越勤快了，从2015年(ES6)开始，每年发布一个新的ECMAScipt标准。今年大佬们继续忙于处理各种<a target="_blank" rel="noopener" href="https://github.com/tc39/proposals">proposal</a>。<a target="_blank" rel="noopener" href="https://www.ecma-international.org/publications/standards/Ecma-262.htm">ECMAScript 2018</a>，即ES9，则在6月如期发布了，其新增的特性并不多：</p>
            <p><strong>主要新特性:</strong></p>
            <ul>
              <li><a target="_blank" rel="noopener" href="http://2ality.com/2016/10/asynchronous-iteration.html">Asynchronous Iteration</a></li>
              <li><a target="_blank" rel="noopener" href="http://2ality.com/2016/10/rest-spread-properties.html">Rest/Spread Properties</a></li>
            </ul>
            <p><strong>新的正则表达式特性:</strong></p>
            <ul>
              <li><a target="_blank" rel="noopener" href="http://2ality.com/2017/05/regexp-named-capture-groups.html">RegExp named capture groups</a></li>
              <li><a target="_blank" rel="noopener" href="http://2ality.com/2017/07/regexp-unicode-property-escapes.html">RegExp Unicode Property Escapes</a></li>
              <li><a target="_blank" rel="noopener" href="http://2ality.com/2017/05/regexp-lookbehind-assertions.html">RegExp Lookbehind Assertions</a></li>
              <li><a target="_blank" rel="noopener" href="http://2ality.com/2017/07/regexp-dotall-flag.html">s (dotAll) flag for regular expressions</a></li>
            </ul>
            <p><strong>其他新特性:</strong></p>
            <ul>
              <li><a target="_blank" rel="noopener" href="http://2ality.com/2017/07/promise-prototype-finally.html">Promise.prototype.finally()</a></li>
              <li><a target="_blank" rel="noopener" href="http://2ality.com/2016/09/template-literal-revision.html">Template Literal Revision</a><br>如果想了解ES9的细节，阔以看看<a target="_blank" rel="noopener" href="http://dr-axel.de/">Axel Rauschmayer</a>博士写的<a target="_blank" rel="noopener" href="http://exploringjs.com/es2018-es2019/toc.html">Exploring ES2018 and ES2019</a>。</li>
            </ul>
            <h2 id="Node-10"><a href="#Node-10" class="headerlink" title="Node 10"></a>Node 10</h2>
            <p>Node 10在4月<a target="_blank" rel="noopener" href="https://nodejs.org/en/blog/release/v10.0.0/">发布</a>并且在10月成为<a target="_blank" rel="noopener" href="https://medium.com/@nodejs/october-brings-node-js-10-x-to-lts-and-node-js-11-to-current-ae19f8f12b51">LTS</a>，即长期支持版本。</p>
            <p>Node 10使用了新的<a target="_blank" rel="noopener" href="https://v8.dev/">V8</a>引擎6.8，因此性能提升了很多，比如<a target="_blank" rel="noopener" href="https://v8.dev/blog/fast-async">Promise与Async函数的性能提升就非常明显</a>，因此建议大家升级。</p>
            <p>Node新版本的<a target="_blank" rel="noopener" href="https://github.com/nodejs/release">发布日期</a>一直非常稳定，做到这一点也是不容易啊！</p>
            <p><img src="" data-original="/images/FrontEnd/0002.png" alt="0002"></p>
            <h2 id="Vue-3-0"><a href="#Vue-3-0" class="headerlink" title="Vue 3.0"></a>Vue 3.0</h2>
            <p>在<a target="_blank" rel="noopener" href="https://vuetoronto.com/">Vue.js Conference Toronto 2018</a>上，尤雨溪发表了主题演讲<a target="_blank" rel="noopener" href="https://docs.google.com/presentation/d/1yhPGyhQrJcpJI2ZFvBme3pGKaGNiLi709c37svivv0o/edit#slide=id.p">Vue 3.0 Updates</a>，新版本将会有这些变化：</p>
            <ul>
              <li>更快</li>
              <li>更小</li>
              <li>更易于维护</li>
              <li>更多的原生支持</li>
              <li><a target="_blank" rel="noopener" href="https://www.zhihu.com/question/46397274/answer/101193678">放弃Flow，使用TypeScript</a></li>
            </ul>
            <p>Vue 3.0<a target="_blank" rel="noopener" href="https://medium.com/the-vue-point/plans-for-the-next-iteration-of-vue-js-777ffea6fabf">预计将在2019发布</a>，大家期待吧！</p>
            <h2 id="Babel-7"><a href="#Babel-7" class="headerlink" title="Babel 7"></a>Babel 7</h2>
            <p>2年多时间commit了4000多次，<a target="_blank" rel="noopener" href="https://babeljs.io/blog/2018/08/27/7.0.0">Babel 7终于发布了</a>，新增了下面这些特性：</p>
            <ul>
              <li><a target="_blank" rel="noopener" href="https://www.npmjs.com/package/babel-upgrade">babel-upgrade</a>: 升级Babel的工具；</li>
              <li><a target="_blank" rel="noopener" href="https://babeljs.io/docs/en/next/config-files#project-wide-configuration">babel.config.js</a>：学习ESLint与Webpack，使用JS文件配置；</li>
              <li><a target="_blank" rel="noopener" href="https://babeljs.io/docs/en/options#overrides">overrides</a>：允许同一个项目使用不同的Babel配置，例如前端代码的targets为Chrome 60，而后端代码的targets为Node 8；</li>
              <li>…</li>
            </ul>
            <p><img src="" data-original="/images/FrontEnd/0003.png" alt="0003"></p>
            <p>主流浏览器对新的ECMAScript特性已经支持得不错了，不过还是存在并且永远存在很多非主流浏览器，于是我们还是离不开神奇的Babel。</p>
            <h2 id="jQuery-3-3-0"><a href="#jQuery-3-3-0" class="headerlink" title="jQuery 3.3.0"></a>jQuery 3.3.0</h2>
            <p>曾经风靡一时的<a target="_blank" rel="noopener" href="http://blog.jquery.com/2018/01/19/jquery-3-3-0-a-fragrant-bouquet-of-deprecations-and-is-that-a-new-feature/">jQuery发布了3.3.0</a>，这个版本放弃了(deprecated)一系列方法：</p>
            <ul>
              <li>jQuery.now</li>
              <li>jQuery.isWindow</li>
              <li>jQuery.camelCase</li>
              <li>jQuery.proxy</li>
              <li>jQuery.type</li>
              <li>jQuery.isNumeric</li>
              <li>jQuery.isFunction</li>
              <li>Event aliases<br>这些方法大多会在jQuery 4.0中被删除，因此jQuery官方鼓励大家使用替代的方法。</li>
            </ul>
            <p>从这个更新也能看出端倪，jQuery时代已经逐渐过去了，<a target="_blank" rel="noopener" href="https://githubengineering.com/removing-jquery-from-github-frontend/">GitHub的极客们干脆完全抛弃了jQuery</a>。</p>
            <h2 id="V8引擎10周年"><a href="#V8引擎10周年" class="headerlink" title="V8引擎10周年"></a>V8引擎10周年</h2>
            <p>强大的<a target="_blank" rel="noopener" href="https://v8.dev/blog/10-years">V8引擎已经发布10周年</a>了，它的命名灵感来自超级性能车的V8引擎，果然名副其实！其性能一直稳步提高：</p>
            <p><img src="" data-original="/images/FrontEnd/0004.png" alt="0004"></p>
            <p>V8引擎当初是为Chrome浏览器开发的，但是早已成为一个独立的项目。国内的众多浏览器，包括搜狗、360、猎豹、QQ、百度、UC都是基于<a target="_blank" rel="noopener" href="https://zh.wikipedia.org/wiki/Chromium">Chromium浏览器</a>开发，而Chromium相当于开源版本的Chrome，自然也是基于V8引擎的。因此，众多”国产”浏览器实际上都是基于V8的。融资了2.5亿元红芯浏览器也不例外，他们干脆打包了Chrome浏览器的安装包，果然有钱任性！还有，就连浏览器界的一朵奇葩<a target="_blank" rel="noopener" href="https://www.ifanr.com/1138933">Microsoft也投靠了Chromium阵营</a>。</p>
            <p>另外，Node.js也是基于V8引擎的。</p>
            <h2 id="NPM模块event-stream被黑客攻击"><a href="#NPM模块event-stream被黑客攻击" class="headerlink" title="NPM模块event-stream被黑客攻击"></a>NPM模块event-stream被黑客攻击</h2>
            <p>这件事闹得沸沸扬扬，不过只是有很多噱头，如果<a target="_blank" rel="noopener" href="https://blog.fundebug.com/2018/12/03/how-does-javascript-hacker-steal-bitcoin/">认真分析黑客干了什么</a>，其真实影响没那么大，至少Vue开发者没啥好担心的：</p>
            <ul>
              <li>比特币钱包<a target="_blank" rel="noopener" href="https://github.com/bitpay/copay">copay</a>依赖<a target="_blank" rel="noopener" href="https://github.com/dominictarr/event-stream">event-stream</a>模块；</li>
              <li>黑客从骗取了<a target="_blank" rel="noopener" href="https://github.com/dominictarr/event-stream">event-stream</a>模块的npm发布权限；</li>
              <li>黑客为<a target="_blank" rel="noopener" href="https://github.com/dominictarr/event-stream">event-stream</a>模块添加了依赖<a target="_blank" rel="noopener" href="https://www.npmjs.com/package/flatmap-stream">flatmap-stream</a>；</li>
              <li><a target="_blank" rel="noopener" href="https://www.npmjs.com/package/flatmap-stream">flatmap-stream</a>含有黑客代码，仅会在<a target="_blank" rel="noopener" href="https://github.com/bitpay/copay">copay</a>项目中正确执行，窃取用户的密码、私钥等信息，从而盗取比特币；</li>
              <li>有人说什么Vue可能遭受攻击，其实没有这回事，因为黑客代码只会在<a target="_blank" rel="noopener" href="https://github.com/bitpay/copay">copay</a>项目中正确执行。只有<a target="_blank" rel="noopener" href="https://github.com/bitpay/copay">copay</a>项目的<a target="_blank" rel="noopener" href="https://github.com/bitpay/copay/blob/cd3f2b380588e6bc90e6c498bf9ae075bcc59e34/package.json">package.json</a>中的<a target="_blank" rel="noopener" href="https://github.com/bitpay/copay/blob/cd3f2b380588e6bc90e6c498bf9ae075bcc59e34/package.json#L3">description</a>字符串”A Secure Bitcoin Wallet”能够解密黑客代码；而且，黑客的代码是为<a target="_blank" rel="noopener" href="https://github.com/bitpay/copay">copay</a>量身定做的，对其他项目没有作用；再说，黑客是来窃取的比特币的，又不是挖矿，你的项目有比特币给人家偷吗?<br>同学们，不要被标题党给骗了啊！</li>
            </ul>
            <h2 id="《Refactoring》第2版改用JavaScript"><a href="#《Refactoring》第2版改用JavaScript" class="headerlink" title="《Refactoring》第2版改用JavaScript"></a>《Refactoring》第2版改用JavaScript</h2>
            <p><a target="_blank" rel="noopener" href="https://book.douban.com/subject/1229923/">《重构：改善既有代码的设计》</a>大多数人都没看过，但是至少应该都听过。这本书刚出了<a target="_blank" rel="noopener" href="https://www.amazon.com/gp/product/0134757599">第二版</a>，所有示例代码由Java改成了JavaScript。</p>
            <p>根据作者<a target="_blank" rel="noopener" href="https://martinfowler.com/articles/refactoring-2nd-ed.html">Martin Fowler</a>的<a target="_blank" rel="noopener" href="https://martinfowler.com/articles/refactoring-2nd-ed.html">解释</a>，《重构》这本书重点在于思想，适用于各种编程语言，所以选择什么语言并不重要。而他选择JavaScript的原因很简单，因为JS既支持面向过程编程，又支持面向对象编程，这样方便写非OOP代码重构的示例。</p>
            <p>这里不妨引用<a target="_blank" rel="noopener" href="https://www.zhihu.com/question/46397274/answer/101193678">尤雨溪</a>的一句话：</p>
            <blockquote>
              <p>至于重构、设计什么的，我只想说，看的是使用的人的水平，跟用什么语言没那么大关系。水平烂的人用 TS 一样写的是翔一样的代码，看看 java 就知道了。</p>
            </blockquote>
            <p>《Refactoring》的示例代码用什么语言写根本不重要，重要的是背后的编程思想。顺便推荐一下《Clean Code》。</p>
            <p><img src="" data-original="/images/FrontEnd/0005.jpg" alt="0005"></p>
            <p>这本书原价54.66刀，的确有点贵，不过算是必读书，大家看着办…</p>
            <h2 id="GitHub抛弃jQuery"><a href="#GitHub抛弃jQuery" class="headerlink" title="GitHub抛弃jQuery"></a>GitHub抛弃jQuery</h2>
            <p>一直以来，GitHub最流行的编程语言都是JavaScript，可以说GitHub是全球最大的JS开发者社交平台了；同时，因为被IE的兼容问题折磨了多年，前端痛恨Microsoft！但是，有钱任性的Microsoft以75亿美元收购了GitHub！</p>
            <p>另外，<a target="_blank" rel="noopener" href="https://githubengineering.com/removing-jquery-from-github-frontend/">GitHub的技术极客们花了数年时间，以非常规范的流程完全移除GitHub网站了jQuery</a>：</p>
            <ul>
              <li>实现了一个ESlint插件<a target="_blank" rel="noopener" href="https://github.com/dgraham/eslint-plugin-jquery">eslint-plugin-jquery</a>，禁止在代码中使用已经弃用的jQuery方法。这样可以防止同事使用jQuery方法。</li>
              <li>使用原生代码重写了2个依赖于jQuery的模块<a target="_blank" rel="noopener" href="https://github.com/defunkt/jquery-pjax">jquery-pjax</a>和<a target="_blank" rel="noopener" href="https://github.com/defunkt/facebox">facebox</a>。</li>
              <li>开发一个定制的jQuery版本，一旦完全移除某个jQuery方法，就删除jQuery中的对应代码。这样既可以减少jQuery大小，也可以防止同事使用已经移除的jQuery方法。</li>
              <li>根据用户统计数据，来逐步放弃支持低版本的IE浏览器，这样的话可以无需依赖jQuery来保证兼容性。</li>
              <li>…<br>是否使用jQuery各有各的想法和需求，<strong>但是GitHub弃用jQuery的流程非常专业，可以作为处理技术债的标准规范。</strong></li>
            </ul>
            <h2 id="Microsoft爱上JavaScript"><a href="#Microsoft爱上JavaScript" class="headerlink" title="Microsoft爱上JavaScript"></a>Microsoft爱上JavaScript</h2>
            <p>土豪Microsoft似乎爱上了JavaScript，它家的<a target="_blank" rel="noopener" href="https://www.reddit.com/r/programming/comments/8qqhlz/comment/e0ll1dt/">Office 365, MicroSoft Teams以及Skype都开始使用JavaScript重写了</a>。原因无疑是JS的跨平台特性。同一套代码多处运行，虽然现在还有很多问题，但是这样的未来不是挺好么？</p>
            <p>此处应该再来感受一下大名鼎鼎的<a target="_blank" rel="noopener" href="https://blog.codinghorror.com/the-principle-of-least-power/">Atwood’s Law</a>：</p>
            <blockquote>
              <p>Any application that can be written in JavaScript, will eventually be written in JavaScript</p>
            </blockquote>
            <p>在浏览器市场上，Microsoft曾经通过捆绑Windows打败了网景，不过这些年在Chrome面前一败涂地，现在终于”认输”，选择<a target="_blank" rel="noopener" href="https://www.ifanr.com/1138933">基于Chromium重写浏览器</a>。对于JSer来说，至少意味着浏览器兼容问题可以缓解很多。</p>
            <p>根据<a target="_blank" rel="noopener" href="https://2018.stateofjs.com/other-tools/">The State of JavaScript 2018</a>，Microsoft开发的<a target="_blank" rel="noopener" href="https://code.visualstudio.com/">Visual Studio code</a>俨然已经成为最受JSer欢迎的代码编辑器，一些流行插件下载量高达上千万：</p>
            <p><img src="" data-original="/images/FrontEnd/0006.png" alt="0006"></p>
            <p>市值超过Apple，重回全球市值最高公司的Microsoft有钱任性，买下了JS开发者最多的GitHub。</p>
            <p>IT界的罗马帝国(出处：吴军《浪潮之巅》)Microsoft又重新崛起了，这是一件很了不起的事情。</p>
            <h2 id="Oracle宣示JavaScript主权"><a href="#Oracle宣示JavaScript主权" class="headerlink" title="Oracle宣示JavaScript主权"></a>Oracle宣示JavaScript主权</h2>
            <p><a target="_blank" rel="noopener" href="https://mp.weixin.qq.com/s/gRtOaTXdLYVrIPnejVytMw">Oracle明年就要开始给Java收费</a>，虽然只是JDK 8的u192之后的更新要收费，这个行为大概会让很多Java开发者不爽…</p>
            <p>另外，<a target="_blank" rel="noopener" href="https://mp.weixin.qq.com/s/Q5bK8qHgLRzTsrA3NdC9wQ">Oracle还要求一个iOS开发者将一款叫做”HTML5, CSS, JavaScript, HTML, Snippet Editor“的App从App Store下架</a>，因为App名字中包含“JavaScript”字眼，而Oracle拥有JavaScript在美国的商标权。</p>
            <p>Oracle这位大爷惹不起，因此大家正在一本正经地<a target="_blank" rel="noopener" href="https://www.techrepublic.com/article/why-its-finally-time-to-give-up-on-the-name-javascript/">建议给JavaScript改名</a>。当然这基本上是不可能的，这辈子都不可能。。。</p>
            <h1 id="参考"><a href="#参考" class="headerlink" title="参考"></a>参考</h1>
            <ul>
              <li><a target="_blank" rel="noopener" href="https://blog.fundebug.com/2018/12/25/what-happens-in-2018-for-javascript/">2018年，JavaScript都经历了什么？</a></li>
              <li><a target="_blank" rel="noopener" href="https://blog.fundebug.com/2018/12/03/how-does-javascript-hacker-steal-bitcoin/">JavaScript黑客是这样窃取比特币的，Vue开发者不用担心！</a></li>
              <li><a target="_blank" rel="noopener" href="https://blog.fundebug.com/2018/11/28/10-english-technolody-newsletter/">强烈推荐10个值得订阅的国外技术周报</a></li>
              <li><a target="_blank" rel="noopener" href="https://blog.fundebug.com/2018/08/10/ecmascript-2018/">ECMAScript 2018特性确定了</a></li>
            </ul>

          </div>





          <footer class="post-footer">
            <div class="post-tags">
              <a href="/tags/2018/" rel="tag"># 2018</a>
            </div>



            <div class="post-nav">
              <div class="post-nav-item">
                <a href="/blob/2019-04-09-cross-domain-resource-sharing-cors/" rel="prev" title="跨域资源共享 CORS">
                  <i class="fa fa-chevron-left"></i> 跨域资源共享 CORS
                </a>
              </div>
              <div class="post-nav-item">
                <a href="/blob/2019-04-15-introduction-to-cookie/" rel="next" title="cookie 简介">
                  cookie 简介 <i class="fa fa-chevron-right"></i>
                </a>
              </div>
            </div>
          </footer>
        </article>
      </div>







      <script>
        window.addEventListener('tabs:register', () => {
          let {
            activeClass
          } = CONFIG.comments;
          if (CONFIG.comments.storage) {
            activeClass = localStorage.getItem('comments_active') || activeClass;
          }
          if (activeClass) {
            const activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
            if (activeTab) {
              activeTab.click();
            }
          }
        });
        if (CONFIG.comments.storage) {
          window.addEventListener('tabs:click', event => {
            if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
            const commentClass = event.target.classList[1];
            localStorage.setItem('comments_active', commentClass);
          });
        }
      </script>
    </div>
  </main>

  <footer class="footer">
    <div class="footer-inner">


      <div class="copyright">
        &copy;
        <span itemprop="copyrightYear">2021</span>
        <span class="with-love">
          <i class="fa fa-heart"></i>
        </span>
        <span class="author" itemprop="copyrightHolder">holidaypenguin</span>
      </div>
      <div class="powered-by">由 <a href="https://hexo.io/" class="theme-link" rel="noopener" target="_blank">Hexo</a> & <a href="https://theme-next.js.org/mist/" class="theme-link" rel="noopener" target="_blank">NexT.Mist</a> 强力驱动
      </div>

    </div>
  </footer>


  <script size="300" alpha="0.1" zIndex="-1" src="https://cdn.jsdelivr.net/npm/ribbon.js@1.0.2/dist/ribbon.min.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/animejs@3.2.1/lib/anime.min.js"></script>
  <script src="/js/love.js"></script>

  <script src="/js/development.js"></script>
  <script src="/js/utils.js"></script>
  <script src="/js/motion.js"></script>
  <script src="/js/schemes/muse.js"></script>
  <script src="/js/next-boot.js"></script>


  <script src="/js/local-search.js"></script>









  <script>
    (function() {
      function leancloudSelector(url) {
        url = encodeURI(url);
        return document.getElementById(url).querySelector('.leancloud-visitors-count');
      }

      function addCount(Counter) {
        const visitors = document.querySelector('.leancloud_visitors');
        const url = decodeURI(visitors.id);
        const title = visitors.dataset.flagTitle;

        Counter('get', '/classes/Counter?where=' + encodeURIComponent(JSON.stringify({
            url
          })))
          .then(response => response.json())
          .then(({
            results
          }) => {
            if (results.length > 0) {
              const counter = results[0];
              leancloudSelector(url).innerText = counter.time + 1;
              Counter('put', '/classes/Counter/' + counter.objectId, {
                  time: {
                    '__op': 'Increment',
                    'amount': 1
                  }
                })
                .catch(error => {
                  console.error('Failed to save visitor count', error);
                });
            } else {
              Counter('post', '/classes/Counter', {
                  title,
                  url,
                  time: 1
                })
                .then(response => response.json())
                .then(() => {
                  leancloudSelector(url).innerText = 1;
                })
                .catch(error => {
                  console.error('Failed to create', error);
                });
            }
          })
          .catch(error => {
            console.error('LeanCloud Counter Error', error);
          });
      }

      function showTime(Counter) {
        const visitors = document.querySelectorAll('.leancloud_visitors');
        const entries = [...visitors].map(element => {
          return decodeURI(element.id);
        });

        Counter('get', '/classes/Counter?where=' + encodeURIComponent(JSON.stringify({
            url: {
              '$in': entries
            }
          })))
          .then(response => response.json())
          .then(({
            results
          }) => {
            for (let url of entries) {
              const target = results.find(item => item.url === url);
              leancloudSelector(url).innerText = target ? target.time : 0;
            }
          })
          .catch(error => {
            console.error('LeanCloud Counter Error', error);
          });
      }

      const {
        app_id,
        app_key,
        server_url
      } = {
        "enable": true,
        "app_id": "povuqNsSqFodlakVIwtEX5kb-gzGzoHsz",
        "app_key": "zXD40RDtDB3DMtpC89k0AK7g",
        "server_url": null,
        "security": false
      };

      function fetchData(api_server) {
        const Counter = (method, url, data) => {
          return fetch(`${api_server}/1.1${url}`, {
            method,
            headers: {
              'X-LC-Id': app_id,
              'X-LC-Key': app_key,
              'Content-Type': 'application/json',
            },
            body: JSON.stringify(data)
          });
        };
        if (CONFIG.page.isPost) {
          if (CONFIG.hostname !== location.hostname) return;
          addCount(Counter);
        } else if (document.querySelectorAll('.post-title-link').length >= 1) {
          showTime(Counter);
        }
      }

      const api_server = app_id.slice(-9) === '-MdYXbMMI' ? `https://${app_id.slice(0, 8).toLowerCase()}.api.lncldglobal.com` : server_url;

      if (api_server) {
        fetchData(api_server);
      } else {
        fetch('https://app-router.leancloud.cn/2/route?appId=' + app_id)
          .then(response => response.json())
          .then(({
            api_server
          }) => {
            fetchData('https://' + api_server);
          });
      }
    })();
  </script>



<script>
            window.imageLazyLoadSetting = {
                isSPA: false,
                preloadRatio: 1,
                processImages: null,
            };
        </script><script>window.addEventListener("load",function(){var t=/\.(gif|jpg|jpeg|tiff|png)$/i,r=/^data:image\/[a-z]+;base64,/;Array.prototype.slice.call(document.querySelectorAll("img[data-original]")).forEach(function(a){var e=a.parentNode;"A"===e.tagName&&(e.href.match(t)||e.href.match(r))&&(e.href=a.dataset.original)})});</script><script>!function(n){n.imageLazyLoadSetting.processImages=o;var e=n.imageLazyLoadSetting.isSPA,i=n.imageLazyLoadSetting.preloadRatio||1,r=Array.prototype.slice.call(document.querySelectorAll("img[data-original]"));function o(){e&&(r=Array.prototype.slice.call(document.querySelectorAll("img[data-original]")));for(var t,a=0;a<r.length;a++)0<=(t=(t=r[a]).getBoundingClientRect()).bottom&&0<=t.left&&t.top<=(n.innerHeight*i||document.documentElement.clientHeight*i)&&function(){var t,e,n,i,o=r[a];t=o,e=function(){r=r.filter(function(t){return o!==t})},n=new Image,i=t.getAttribute("data-original"),n.onload=function(){t.src=i,e&&e()},t.src!==i&&(n.src=i)}()}o(),n.addEventListener("scroll",function(){var t,e;t=o,e=n,clearTimeout(t.tId),t.tId=setTimeout(function(){t.call(e)},500)})}(this);</script></body>

</html>